package com.wty.schedule.quartzSchedule.jobs;

import org.quartz.*;

@DisallowConcurrentExecution
public class HelloJob implements Job {

    private String age;

    public void setAge(String age) {
        this.age = age;
    }

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //真正要执行的业务逻辑
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        JobDetail jobDetail=jobExecutionContext.getJobDetail();
        String name=jobDetail.getJobDataMap().getString("name");
        System.out.println("执行者"+name+"的年龄是"+age);
    }
}
